package com.xuecheng.teaching.agent;

import com.xuecheng.api.comment.model.dto.CommentDTO;
import com.xuecheng.api.comment.model.dto.CommentReplyDTO;
import com.xuecheng.api.comment.model.qo.CommentConditionModel;
import com.xuecheng.api.comment.model.vo.CommentStatisticsVo;
import com.xuecheng.common.constant.XcFeignServiceNameList;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.common.domain.response.RestResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * Feign远程调用 评论管理
 * <p>
 * import javax.validation.Valid;
 * <p>
 * /**
 * Feign远程调用 教学机构管理
 */
@FeignClient(value = XcFeignServiceNameList.XC_COMMENT_SERVICE)
public interface CommentApiAgent {

    String SERVICE_CONTEXT_PRE = "/comment";

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/list")
    RestResponse<PageVO<CommentDTO>> list(@RequestParam PageRequestParams params, @Valid @RequestBody CommentConditionModel commentModel, @RequestParam Boolean company);

    @PostMapping("comment/course-comment")
    RestResponse<CommentDTO> comment(@Valid @RequestBody CommentDTO commentDTO);

    @PostMapping("comment/course-comment/praise/{commentId}")
    RestResponse<CommentDTO> praise(@PathVariable Long commentId);

    @DeleteMapping("comment/{commentId}")
    RestResponse<CommentDTO> delComment(@PathVariable Long commentId);

    @GetMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/course-statistics/{coursePubId}")
    RestResponse<CommentStatisticsVo> getStatistics(@PathVariable @RequestParam Long coursePubId);

    @DeleteMapping("comment/batch-del/{commentIds}")
    RestResponse<Boolean> batchDelComment(@PathVariable List<Long> commentIds);

    /**
     * 根据id获得评论--远程调用
     *
     * @param commentId
     * @return
     */
    @PostMapping("comment/l/comment/{commentId}")
    RestResponse<CommentDTO> getCommentById(@PathVariable Long commentId);

    /**
     * 回复评论--远程调用
     *
     * @param replyDTO
     * @return
     */
    @PostMapping("comment/l/commentReply")
    RestResponse<CommentReplyDTO> reply(@Valid @RequestBody CommentReplyDTO replyDTO);

}
